package com.my.strings;

import cn.hutool.core.util.StrUtil;

import java.util.Arrays;

/**
 * @author: marshal
 * @date: 2022-08-02 11:17
 */
public class StrUtilTest {
    public static void main(String[] args) {
      test2();
    }

    public static void test() {
        String s1 = "hello";
        String s2 = "world";
        System.out.println();
        String s = StrUtil.addSuffixIfNot(s1, s2);
        System.out.println(s);
        System.out.println(s1.concat(s2));
        System.out.println(StrUtil.sub("20150721160156002104088040", 0, 14));
        System.out.println(StrUtil.sub("20150721160156002104088040", 18, 20));
        // 字符串切割
        String str = "aabbccddeeffgghh";
        String[] split = StrUtil.split(str, 2);
        System.out.println(Arrays.toString(split));
    }

    private static void test2() {
        String s = "A 2 002 ftp://172.10.26.160//CAM002 20150721160156002104088040.dat \\n";
        String[] split = s.split(" ");
        String s2 = Arrays.toString(split);
        System.out.println(s2);
        System.out.println(split[3].substring(21, 27));
    }
}
